/*
 *  Created on: May 17, 2009
 *      Author: Ramesh Rajaby
 */


#ifndef _SYMPHONY_BYTECODE_STRUCTURES_
#define _SYMPHONY_BYTECODE_STRUCTURES_


#include "../Shared.h"
#include "../AST/AST.h"

namespace SymphonyBC {


class InstructionBC {
public:
	OpCode opcode;
	StackPointer op1, op2, op3;

	InstructionBC() {
		op1 = op2 = op3 = 0;
	}
};


class MethodBC {
private:
	vector<InstructionBC*> instructions;
	string name;
	int returnType;

public:
	string getName() {
		return name;
	}
	void setName(const string& name) {
		this->name = name;
	}

	int getReturnType() {
		return returnType;
	}
	void setReturnType(int returnType) {
		this->returnType = returnType;
	}

	void addInstruction(InstructionBC* instruction) {
		instructions.push_back(instruction);
	}
	InstructionBC* getInstruction(int i) {
		return instructions[i];
	}

	vector<InstructionBC*> getInstructions() {
		return instructions;
	}
};


class ClassBC {
private:
	vector<MethodBC*> methods;
	string name;
	string dataArea;

public:
	string getName() {
		return name;
	}
	void setName(const string& name) {
		this->name = name;
	}

	void addMethod(const string& name, MethodBC* method) {
		methods.push_back(method);
	}
	MethodBC* getMethod(int id) {
		return methods[id];
	}
	vector<MethodBC*> getMethods() {
		return methods;
	}

    string getDataArea() const {
        return dataArea;
    }
    void setDataArea(string dataArea) {
        this->dataArea = dataArea;
    }
};


}


#endif
